/*************************************************************************
	> File Name: exchange_value.cc
	> Author: likang
	> Mail:  
	> Created Time: 2014年11月29日 星期六 17时42分30秒
 ************************************************************************/

#include<iostream>
using namespace std;

void
exchange(int *& p, int *&q) {
	int *temp = p;
	p = q;
	q = temp;
}

int
main(void) {
	int a = 2, b = 3;
	int *m = &a;
	int *n = &b;
	cout << "before exchange : m point to "<< *m << " n point to " << *n << endl;
	cout << "before exchange : a value " << a << " b value " << b << endl;
	exchange(m,n);
	cout << "after exchange : m point to "<< *m << " n point to " << *n << endl;
	cout << "after exchange : a value " << a << " b value " << b << endl;
	return 0;
}
